/*
 * This file is part of the OdinMS Maple Story Server
 * Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
 *                    Matthias Butz <matze@odinms.de>
 *                    Jan Christian Meyer <vimes@odinms.de>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License version 3
 * as published by the Free Software Foundation. You may not use, modify
 * or distribute this program under any other version of the
 * GNU Affero General Public License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/* Author: Xterminator
	NPC Name: 		Hotel Receptionist
	Map(s): 		Dungeon : Sleepywood Hotel (105040400)
	Description: 		Hotel Receptionist
*/

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == -1) {
		cm.dispose();
	} else {
	if (status == 1 && mode == 0) {			
		cm.dispose();
		return;
	} else if (status >= 2 && mode == 0) {
		cm.sendOk("We offer other kinds of services too, so please think carefully and then make your decision.");				
		cm.dispose();
		return;
	}
	if (mode == 1)
		status++;
	else
		status--;
	if (status == 0) {
		cm.sendNext("Welcome. We're the Sleepywood Hotel. Our hotel works hard to serve you the best at all times. If you are tired and worn out from hunting, how about a relaxing stay at out hotel?");
	} else if (status == 1) {
			cm.sendSimple("We offer two kinds of rooms for service. Please choose the one of your liking.\r\n#L0##bRegular sauna (499 mesos per use)#k#l\r\n#L1##bVIP Sauna (999 mesos per use)#k#l");
	} else if (status == 2) {
		if (selection == 0) {		
			cm.sendYesNo("You've chosen the regular sauna. Your HP and MP will recover fast and you can even purchase some items there. Are you sure you want to go in?");
		} else if (selection == 1) {
			status = 3;
			cm.sendYesNo("You've chosen the VIP Sauna. Your HP and MP will recover even faster than that of the regular sauna and you can even find a special item in there. Are you sure you want to go in?");
		}
	} else if (status == 3) {
		if (cm.getPlayer().getMeso() < 499) {
			cm.sendOk("I'm sorry. It looks like you don't have enough mesos. It will cost you at least 499 mesos to stay at our hotel.");
			cm.dispose();
		} else {	
			cm.gainMeso(-499);
			cm.warp(105040401, 0);
			cm.dispose();
		}
	} else if (status == 4) {
			if (cm.getPlayer().getMeso() < 999) {
			cm.sendOk("I'm sorry. It looks like you don't have enough mesos. It will cost you at least 999 mesos to stay at our hotel.");
			cm.dispose();
		} else {			
			cm.gainMeso(-999);
			cm.warp(105040402, 0);
			cm.dispose();
			}
		}
	}
}